<template>

  <el-container>
    <el-aside>
      <el-col :span="24">
        <span>千锋旅业后台</span>
        <el-menu
          default-active="1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          :collapse="isCollapse"
          router="true"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b">
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span>系统管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/system/userinfo">用户管理</el-menu-item>
              <el-menu-item index="/system/empinfo">员工管理</el-menu-item>
              <el-menu-item index="/system/role">角色管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>业务管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/work/area">景区管理</el-menu-item>
              <el-menu-item index="/work/spot">景点管理</el-menu-item>
              <el-menu-item index="/work/order">订单管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>系统监控</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/monitor/log">系统日志</el-menu-item>
              <el-menu-item index="/monitor/echarts">系统报表</el-menu-item>
              <el-menu-item index="/monitor/server">服务监控</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-aside>
    <el-container>
    <el-header style=" font-size: 16px">
      <el-radio-group v-model="isCollapse" style="margin-bottom: 20px;">
        <el-radio-button :label="false">展开</el-radio-button>
        <el-radio-button :label="true">收起</el-radio-button>
      </el-radio-group>
      <el-dropdown style="line-height: 20px;text-align: right;">
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item>个人设置</el-dropdown-item>
          <el-dropdown-item>退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <span>{{ userName }}</span>
    </el-header>

      <el-main><router-view/></el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      // 菜单栏的折叠展开控制
      isCollapse: false,
      userName: this.$route.query.userName,
    };
  },

  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
<style scoped>
.el-header,
.el-footer {
  background-color: #f3f3f3;
  color: #333;
  text-align: left;
  line-height: 90px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 60px;
  width:auto;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  line-height: 40px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
/*菜单栏相关*/
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>

